package org.cosmocalc;

public class Cosmology {
	public double omegaM;

	public double omegaL;

	public double hubble;

	public double kappa;

	public double c_H;
	
	public Drdzprop drdzpropObj;

	public Drdz drdzObj;

	public Cosmology() {
		setCosmo(0.3, 0.7, 0.7);
	}

	/**
	 * @return Returns the value of the Hubble constant.
	 */
	public double getHubble() {
		return hubble;
	}

	/**
	 * @param hubble
	 *            The hubble to set.
	 */
	public void setHubble(double hubble) {
		setCosmo(this.omegaM, this.omegaL, hubble);
	}

	/**
	 * @return Returns Omega_Lambda.
	 */
	public double getOmegaL() {
		return omegaL;
	}

	/**
	 * @param omegaL
	 *            The omegaL to set.
	 */
	public void setOmegaL(double omegaL) {
		setCosmo(this.omegaM, omegaL, this.hubble);
	}

	/**
	 * @return Returns Omega_m.
	 */
	public double getOmegaM() {
		return omegaM;
	}

	/**
	 * @param omegaM
	 *            The omegaM to set.
	 */
	public void setOmegaM(double omegaM) {
		setCosmo(omegaM, this.omegaL, this.hubble);
	}

	/**
	 * Set the current cosmology and updates kappa and c_H.
	 * @param om Omega matter (Baryonic + dark matter)
	 * @param ol Omega Lambda  (cosmological constant)
	 * @param hub The Hubble constant
	 */
	public void setCosmo(double om, double ol, double hub) {
		if (hub <= 0.) {
			System.out.println("The Hubble constant must be greater than zero.");
			return;
		}
		this.omegaM = om;
		this.omegaL = ol;
		this.hubble = hub;
		this.c_H = 2997.9 / hubble; // Mpc
		this.kappa = Math.pow((omegaM + omegaL - 1.) / c_H, 2.);
	}

	/**
	 * @return Returns the c_H.
	 */
	public double getC_H() {
		return c_H;
	}

	/**
	 * @return Returns the kappa.
	 */
	public double getKappa() {
		return kappa;
	}

}
